***************************
* "Explaining the surge of the populist right: A time-series analysis of the effects of immigration and the economy in Norway"

********** SETUP **********
set more off
version 16
clear all
set linesize 90


********* LOAD DATA
use "POBE_Haugsgjerd_Berg_2023.dta", clear




******** UNIVARIATE PLOTS
* Frp
tsline frp_avg_support if tin(1991m1,2019m8), scheme(plottig) ///
ytitle("") ///
tmlabel(1993m9 1997m9 2001m9 2005m9 2009m9 2013m9 2017m9) ///
tlabel("") name(frp, replace) title("Support for Frp")

* Asylsøkertall
tsline asl if tin(1991m1,2019m8), scheme(plottig) ///
ytitle("") ///
tmlabel(1993m9 1997m9 2001m9 2005m9 2009m9 2013m9 2017m9) ///
tlabel("") title("Asylum seekers") name(asyl, replace)

* Stock rates
tsline stock_rate if tin(1991m1,2019m8) , /// 
scheme(plottig) ///
ytitle("") ///
tmlabel(1993m9 1997m9 2001m9 2005m9 2009m9 2013m9 2017m9) ///
tlabel("") title("OBX price index") name(bors, replace)

* Arbeidsledighet
tsline unemp if tin(1991m1,2019m8), ///
scheme(plottig) ///
ytitle("") ///
tmlabel(1993m9 1997m9 2001m9 2005m9 2009m9 2013m9 2017m9) ///
tlabel("") title("Unemployment rates") name(ledighet, replace)


graph combine frp asyl bors ledighet



************TABLE 1
* M1) No interactions 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 // 

predict M1_res_rev, res
corrgram M1_res_rev

estimate store M1
estat bgodfrey, lags(1,2,3,4,5,6,7,8,9,10)


* M2) Interaction with immigration 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// l12.unemp_stand
parliamentary_elec EU_referendum utoya frp_gov_growing_acc ///
asylum_crisis_93 asylum_crisis_15 /// 
c.asl_stand#c.frp_gov_growing_acc c.l.asl_stand#c.l.frp_gov_growing_acc c.l2.asl_stand#c.l.frp_gov_growing_acc   // 

predict M2_res_rev, res
corrgram M2_res_rev, lags(12)

estimate store M2
estat bgodfrey, lags(1,2,3,4,5,6,7,8,9,10)


* M3) Interaction with stock rate 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya frp_gov_growing_acc ///
asylum_crisis_93 asylum_crisis_15 ///    
c.stock_rate_stand#c.frp_gov_growing_acc c.l.stock_rate_stand#c.l.frp_gov_growing_acc c.l2.stock_rate_stand#c.l.frp_gov_growing_acc // 


predict M3_res_rev, res
corrgram M3_res_rev

estimate store M3
estat bgodfrey, lags(1,2,3,4,5,6,7,8,9,10)


*M4)Interaction with unemployment 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya frp_gov_growing_acc ///
asylum_crisis_93 asylum_crisis_15 ///   
c.unemp_stand#c.frp_gov_growing_acc c.l.unemp_stand#c.l.frp_gov_growing_acc c.l2.unemp_stand#c.l.frp_gov_growing_acc // 

predict M4_res_rev, res
corrgram M4_res_rev

estimate store M4
estat bgodfrey, lags(1,2,3,4,5,6,7,8,9,10)


**** OUTPUT
* TABLE 1 - stata
esttab M1 M2 M3 M4 , ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 



* TABLE 1 - word
esttab M1 M2 M3 M4 using Table_1.rtf, ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 





***MARGINSPLOT IMIGRATION SHORT TERM 
estimate restore M2

sum frp_gov_growing_acc

margins, dydx(asl_stand)at(frp_gov_growing_acc=(0(0.2)3.0)) vsquish 
marginsplot, ///
recast(line) ///
recastci(rline) ///
ciopts(lpattern(dash)) ///
yline(0) ///
xlabel(#5) ///
legend(on ///
label(1 "95 percent confidence interval") ///
label(2 "Marginal effect of monthly asylum seekers") ///
cols(1)) ///
xtitle("Government responsibility")  ///
ytitle("Marginal effect of monthly asylum seekers", size(small)) ///
title("") ///
scheme(s1mono) //



*************APPENDIX
*** A2) BIANARY ACCOUNTABILITY VARIABLE (frp_gov)


* A2M1) No interactions
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 // 


estimate store A2M1


* A2M2) Interaction with immigration  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya ///
asylum_crisis_93 asylum_crisis_15 frp_gov /// 
c.asl_stand#c.frp_gov c.l.asl_stand#c.l.frp_gov c.l2.asl_stand#c.l.frp_gov //     


estimate store A2M2


* A2M3) Interaction with stock rate  - no immigration dumies 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya  ///
asylum_crisis_93 asylum_crisis_15 frp_gov ///    
c.stock_rate_stand#i.l.frp_gov c.l.stock_rate_stand#i.l.frp_gov c.l2.stock_rate_stand#i.l.frp_gov // 


estimate store A2M3


* A2M4) Interaction with unemployment 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya  ///
asylum_crisis_93 asylum_crisis_15 frp_gov ///   
c.unemp_stand#i.l.frp_gov c.l.unemp_stand#i.l.frp_gov c.l2.unemp_stand#i.l.frp_gov //  


estimate store A2M4


*** OUTPUT

* TABLE A2 - stata
esttab A2M1 A2M2 A2M3 A2M4 , ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 



* TABLE A2 - word
esttab A2M1 A2M2 A2M3 A2M4 using Table_A2.rtf, ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 




*** A3) EXCLUDING IMMIGRATION DUMMIES

* A3M1) No interactions 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  // asylum_crisis_15  asylum_crisis_93

estimate store A3M1


* A3M2) Interaction with immigration 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya frp_gov_growing_acc /// asylum_crisis_93 asylum_crisis_15 
c.asl_stand#c.frp_gov_growing_acc c.l.asl_stand#c.l.frp_gov_growing_acc c.l2.asl_stand#c.l.frp_gov_growing_acc  // 

estimate store A3M2


* A3M3) Interaction with stock rate  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya frp_gov_growing_acc /// asylum_crisis_93 asylum_crisis_15 
c.stock_rate_stand#c.frp_gov_growing_acc c.l.stock_rate_stand#c.l.frp_gov_growing_acc c.l2.stock_rate_stand#c.l.frp_gov_growing_acc // 

estimate store A3M3


* A3M4) Interaction with unemployment 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya frp_gov_growing_acc /// asylum_crisis_93 asylum_crisis_15 
c.unemp_stand#c.frp_gov_growing_acc c.l.unemp_stand#c.l.frp_gov_growing_acc c.l2.unemp_stand#c.l.frp_gov_growing_acc // 


estimate store A3M4


*** OUTPUT

* TABLE A3 - stata
esttab A3M1 A3M2 A3M3 A3M4 , ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 



* TABLE A3 - word
esttab A3M1 A3M2 A3M3 A3M4 using Table_A3.rtf, ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 



************ A4 - 12 month lag on unemployment 

* A4M1) No interactions 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand l12.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// frp_gov_growing_acc
asylum_crisis_15  asylum_crisis_93 // 

estimate store A4M1


* A4M2) Interaction with immigration  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand l12.unemp_stand /// 
parliamentary_elec EU_referendum utoya ///
asylum_crisis_93 asylum_crisis_15 frp_gov_growing_acc /// 
c.asl_stand#c.frp_gov_growing_acc c.l.asl_stand#c.l.frp_gov_growing_acc c.l2.asl_stand#c.l.frp_gov_growing_acc  // 


estimate store A4M2


* A4M3) Interaction with stock rate 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand l12.unemp_stand /// 
parliamentary_elec EU_referendum utoya  ///
asylum_crisis_93 asylum_crisis_15 frp_gov_growing_acc ///    
c.stock_rate_stand#c.frp_gov_growing_acc c.l.stock_rate_stand#c.l.frp_gov_growing_acc c.l2.stock_rate_stand#c.l.frp_gov_growing_acc //


estimate store A4M3


* A4M4)Interaction with unemployment
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand l12.unemp_stand /// 
parliamentary_elec EU_referendum utoya ///
asylum_crisis_93 asylum_crisis_15 frp_gov_growing_acc ///   
c.unemp_stand#c.frp_gov_growing_acc c.l.unemp_stand#c.l.frp_gov_growing_acc c.l2.unemp_stand#c.l.frp_gov_growing_acc //


estimate store A4M4


*** OUTPUT

* TABLE A4 - stata
esttab A4M1 A4M2 A4M3 A4M4 , ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 


* TABLE A4 - word
esttab A4M1 A4M2 A4M3 A4M4 using Table_A4.rtf, ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 




*** A5 - INTERACTION EFFECTS BETWEEN IMMIGRATION AND THE ECNOMY 
* A5M1: IMMIGRATION AND UNEMPLYMENT  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 ///
c.asl_stand#c.unemp_stand 


estimate store model_A5_M1



* A5M2: L1 IMMIGRATION AND L1 UNEMPLYMENT  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 /// 
c.l.asl_stand#c.l.unemp_stand 


estimate store model_A5_M2


* A5M3: L2 IMMIGRATION AND L2 UNEMPLYMENT  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 /// 
c.l2.asl_stand#c.l2.unemp_stand 


estimate store model_A5_M3


* A5M4: IMMIGRATION AND STOCK MARKET  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 /// 
c.asl_stand#c.stock_rate_stand 


estimate store model_A5_M4



* A5M5: L1 IMMIGRATION AND L1 STOCK MARKET 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 /// 
c.l.asl_stand#c.l.stock_rate_stand 


estimate store model_A5_M5


* A5M6: L2 IMMIGRATION AND UNEMPLYMENT L2 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 /// 
c.l2.asl_stand#c.l2.stock_rate_stand 


estimate store model_A5_M6

 

* TABLE A5 - stata
esttab model_A5_M1 model_A5_M2 model_A5_M3 model_A5_M4 model_A5_M5 model_A5_M6 , ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6") 


* TABLE A5 - word
esttab model_A5_M1 model_A5_M2 model_A5_M3 model_A5_M4 model_A5_M5 model_A5_M6 using Table_A5.rtf, ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4" "Model 5" "Model 6") 




*** A6) INCUMBENCY IN FOUR CUTS (frp_gov_growing_acc_cat)

* A2M1) No interactions
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand ///  
unemp_stand l.unemp_stand l2.unemp_stand /// 
parliamentary_elec EU_referendum utoya  /// 
asylum_crisis_15 asylum_crisis_93 // 


estimate store A6M1


* A6M2) Interaction with immigration  
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya ///
asylum_crisis_93 asylum_crisis_15 frp_gov /// 
c.asl_stand#c.frp_gov_growing_acc_cat c.l.asl_stand#c.l.frp_gov_growing_acc_cat c.l2.asl_stand#c.l.frp_gov_growing_acc_cat //     


estimate store A6M2


* A6M3) Interaction with stock rate  - no immigration dumies 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya  ///
asylum_crisis_93 asylum_crisis_15 frp_gov ///    
c.stock_rate_stand#c.l.frp_gov_growing_acc_cat c.l.stock_rate_stand#c.l.frp_gov_growing_acc_cat c.l2.stock_rate_stand#c.l.frp_gov_growing_acc_cat // 


estimate store A6M3


* A2M4) Interaction with unemployment 
regress frp_avg_support l.frp_avg_support l2.frp_avg_support /// 
asl_stand l.asl_stand l2.asl_stand ///  
stock_rate_stand l.stock_rate_stand l2.stock_rate_stand  ///  
unemp_stand l.unemp_stand l2.unemp_stand  /// 
parliamentary_elec EU_referendum utoya  ///
asylum_crisis_93 asylum_crisis_15 frp_gov ///   
c.unemp_stand#c.l.frp_gov_growing_acc_cat c.l.unemp_stand#c.l.frp_gov_growing_acc_cat c.l2.unemp_stand#c.l.frp_gov_growing_acc_cat //  


estimate store A6M4


*** OUTPUT

* TABLE A6 - stata
esttab A6M1 A6M2 A6M3 A6M4 , ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 



* TABLE A6 - word
esttab A6M1 A6M2 A6M3 A6M4 using Table_A6.rtf, replace ///
compress  ///  wide
b(2) not se ///
star(* 0.05 ** 0.01) ///
varlabels(,elist(weight:_cons "{break}{hline @width}")) varwidth(13) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") 


